package com.mt.roll.wms.controller;

import com.mt.roll.core.base.BaseController;
import com.mt.roll.core.constants.CommonConstant;
import com.mt.roll.core.params.IdParam;
import com.mt.roll.core.validator.groups.PageGroup;
import com.mt.roll.core.vo.PageVo;
import com.mt.roll.core.vo.R;
import com.mt.roll.wms.params.CarTaskExecutionInfoHisQueryParam;
import com.mt.roll.wms.service.CarTaskExecutionInfoHisService;
import com.mt.roll.wms.vo.CarTaskExecutionInfoHisVo;
import com.mt.roll.wms.vo.CarTaskExecutionInfoVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.groups.Default;

/**
 * @auther why
 * @date 2021/9/29 15:06
 */
@RestController
@RequestMapping(CommonConstant.API_MODULE_WMS + "car/task/execution/info/his")
@Slf4j
@Api(value = "历史任务列表", tags = "历史任务列表", hidden = false)
public class CarTaskExecutionInfoHisController extends BaseController {

    @Autowired
    private CarTaskExecutionInfoHisService carTaskExecutionInfoHisService;


    @PostMapping(value = "page")
    @ApiOperation(value = "分页当前任务列表")
    private R<PageVo<CarTaskExecutionInfoHisVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody CarTaskExecutionInfoHisQueryParam carTaskExecutionInfoHisQueryParam) {
        return carTaskExecutionInfoHisService.pageByTerm(carTaskExecutionInfoHisQueryParam);
    }

    @PostMapping(value = "get")
    @ApiOperation(value = "获取历史任务详情")
    private R<CarTaskExecutionInfoHisVo> get(@Validated @RequestBody IdParam idParam) {
        return carTaskExecutionInfoHisService.get(idParam);
    }
}
